$color-white: #fff;
$color-primary-light: #01aaed;
$color-primary: #1e9fff;
$spacing: 40px;
$spacing-half: 20px;
$line-width: 1px;
$line-color: #888;
$item-font-size: 14px;

.un-org-tree,
.un-org-tree * {
    margin: 0;
    padding: 0;
    list-style: none;
    border-collapse: collapse;
}
.un-org-tree--wrapper {
    width: 100%;
    overflow: auto;
    box-sizing: border-box;

    .un-org-tree.vertical {
        width: min-content;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        box-sizing: border-box;
        overflow: hidden;
        height: max-content;
        .un-org-tree-item {
            margin: 0 5px;
            &:nth-child(2) {
                margin-left: 0;
            }
            &:last-child {
                margin-right: 0;
            }
            font-size: $item-font-size;
            & > span {
                display: inline-block;

                margin-bottom: $spacing;
                background-color: $color-white;
                position: relative;
                border: $line-width solid $line-color;
                span {
                    display: inline-block;
                    padding: 5px 8px;
                    cursor: pointer;
                }
            }

            /** 子项 S */
            .un-org-tree-item-childer {
                display: flex;
                flex-direction: row;
                position: relative;
                justify-content: center;
            }
            /** 子项 E */
        }

        .leaf > span::after {
            display: none;
            visibility: hidden;
        }
        .un-org-tree--horizontal-line {
            display: block;
            height: 2px;
            width: 100%;
            background: $line-color;
            transform: scaleY(0.5);
            position: absolute;
            top: -$spacing-half - 1;
            z-index: 1;
        }
        .un-org-tree--vertical-line {
            display: block;
            width: 1px;
            height: $spacing-half;
            background: $line-color;
            position: absolute;
            left: 50%;
            &.top {
                top: -$spacing-half - 1;
                transform: translateX(-50%);
            }
            &.bottom {
                bottom: -$spacing-half - 1;
                transform: translateX(-50%);
            }
        }
    }
    .un-org-tree.horizontal {
        width: min-content;
        height: min-content;
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        position: relative;
        &> .un-org-tree-item > span >span > .un-org-tree--horizontal-line.left {
            display: none;
            visibility: hidden;
        }
        .un-org-tree-item {
            width: max-content;
            display: flex;
            flex-direction: row;
            align-items: center;
            margin-left: 40px;
            position: relative;
            font-size: $item-font-size;
            & > span {
                position: relative;
                margin: 5px 0;
                border: $line-width solid $line-color;
                span {
                    display: inline-block;
                    padding: 5px 8px;
                    cursor: pointer;
                }
                .un-org-tree--horizontal-line {
                    display: block;
                    width: $spacing-half;
                    height: 1px;
                    background: $line-color;
                    position: absolute;
                    top: 50%;
                    &.left {
                        left: -$spacing-half - 1px;
                        transform: translateY(-50%);
                    }
                    &.right {
                        transform: translateY(-50%);
                        right: -$spacing-half - 1px;
                    }
                }
            }
            .un-org-tree--vertical-line {
                display: block;
                height: auto;
                width: 1px;
                background: $line-color;
                transform: scaleY(0.5);
                position: absolute;
                z-index: 1;
            }
            .un-org-tree-item-childer {
            }
        }
    }
}
